package com.wxy.ideaplugin.vue;

import com.intellij.lang.annotation.AnnotationHolder;
import com.intellij.lang.annotation.Annotator;
import com.intellij.lang.injection.InjectedLanguageManager;
//import com.intellij.lang.javascript.JavaScriptLanguage;
import com.intellij.lang.xml.XMLLanguage;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiLanguageInjectionHost;
import org.jetbrains.annotations.NotNull;
//import org.jetbrains.yaml.YAMLLanguage;

public class VueDirectiveAnnotator implements Annotator {
    @Override
    public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {

    }


   /* @Override
    public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
        // 检查element是否位于Vue文件中
        PsiFile containingFile = element.getContainingFile();
        if (!isVueFile(containingFile)) {
            return;
        }
        com.jetbrains.intellij.
        // 在这里添加对Vue指令的识别逻辑
        // 例如，检查element是否是v-bind或v-model指令
        // 如果是，则使用holder添加相应的注释
    }

    private boolean isVueFile(PsiFile file) {
        if (file == null) return false;
        InjectedLanguageManager injectedLanguageManager = InjectedLanguageManager.getInstance(file.getProject());
        PsiFile topLevelFile = injectedLanguageManager.getTopLevelFile(file);
        return topLevelFile != null && (topLevelFile.getLanguage() == JavaScriptLanguage.INSTANCE ||
                topLevelFile.getLanguage() == XMLLanguage.INSTANCE ||
                topLevelFile.getLanguage() == YAMLLanguage.INSTANCE);
    }*/
}